package com.tbit.uqbike.object.pojo;

import com.tbit.common.entity.BaseEntity;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

import javax.validation.constraints.NotNull;
import java.util.Objects;

/**
 * 品牌对接参数配置对象 brand_remote_config
 *
 * @author jing
 * @date 2021-04-21
 */
@Data
@ToString
@NoArgsConstructor
public class BrandRemoteConfig extends BaseEntity {
    private static final Long serialVersionUID = 1L;

    /**
     * 分页条数
     */
    private Long rowCount;

    /**
     * 页数
     */
    private Long pageNO;

    /**
     * 品牌id
     */
    @NotNull(message = "ver.accountId.notNull")
    private Integer accountId;

    /**
     * 配置类型
     */
    @NotNull(message = "ver.configType.notNull")
    private Integer configType;

    /**
     * 参数键值对(k=v;k=v(多个分号分隔))
     */
    private String paramKV;

    private String remark;

    public BrandRemoteConfig(@NotNull(message = "ver.accountId.notNull") Integer accountId, @NotNull(message = "ver.configType.notNull") Integer configType, String paramKV) {
        this.accountId = accountId;
        this.configType = configType;
        this.paramKV = paramKV;
    }

    public BrandRemoteConfig(Integer accountId, Integer configType) {
        this.accountId = accountId;
        this.configType = configType;
    }

    /**
     * 重写equals方法
     *
     */
    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null || getClass() != obj.getClass()) {
            return false;
        }
        BrandRemoteConfig that = (BrandRemoteConfig) obj;
        return  accountId.equals(that.accountId)
                && configType.equals(that.configType)
                && paramKV.equals(that.paramKV);
    }

    /**
     * 重写hashCode方法
     *
     */
    @Override
    public int hashCode() {
        return Objects.hash(accountId, configType,paramKV);
    }

    /**
     * 重写toString方法
     *
     */
    @Override
    public String toString() {
        return "BrandRemoteConfig{" +
                " accountId=" + accountId +
                ", configType=" + configType +
                ", paramKV='" + paramKV + '\'' +
                '}';
    }
}
